import request from '@/utils/require'
// request.post()的返回值是promise对象
export const getArticles = params => request.get('/h5/interview/query', { params })

export const getArticleDetail = id => request.get('h5/interview/show', { params: { id } })

export const updateLike = (id) => {
  return request.post('h5/interview/opt', {
    id,
    optType: 1 // 喜欢
  })
}

export const updateCollect = (id) => {
  return request.post('h5/interview/opt', {
    id,
    optType: 2 // 收藏
  })
}

export const getArticlesCollect = (obj) => {
  return request.get('h5/interview/opt/list', {
    params: {
      page: obj.page, // 当前页
      pageSize: 5, // 可选
      optType: 2 // 表示收藏
    }
  })
}
export const getArticlesLike = (obj) => {
  return request.get('h5/interview/opt/list', {
    params: {
      page: obj.page, // 当前页
      pageSize: 5, // 可选
      optType: 1 // 表示喜欢
    }
  })
}
